home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / background_4755.txt < prev    next >
Text File  |  1991-02-27  |  18KB  |  770 lines

  1. -- background: 4755 from stack: in
  2. -- bmap block id: 3717
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: page
  6. ----- HyperTalk script -----
  7. on openCard
  8.   updateBookmarks (the number of this card)
  9.   send showBookmarks
  10.   send showFootnotes
  11.   pass openCard
  12. end openCard
  13.  
  14. on showBookmarks
  15.   global bookmark1
  16.   global bookmark2
  17.   get the id of this card
  18.   if it is bookmark1 or it is bookmark2 then
  19.     show background button "mark"
  20.   else
  21.     hide background button "mark"
  22.   end if
  23. end showBookmarks
  24.  
  25. on showFootnotes
  26.   get field "footnote1"
  27.   if it is not "" then
  28.     show field "footnote1"
  29.   else
  30.     hide field "footnote1"
  31.   end if
  32.   get field "footnote2"
  33.   if it is not "" then
  34.     show field "footnote2"
  35.   else
  36.     hide field "footnote2"
  37.   end if
  38. end showFootnotes
  39.  
  40. on arrowKey choice
  41.   put false into dontScroll
  42.   if visible of background button "Done Changes" is true then
  43.     beep
  44.     put true into dontScroll
  45.   end if
  46.   if (the name of this card is the name of card "contents") then
  47.     if visible of card button "Done Changes" is true then
  48.       beep
  49.       put true into dontScroll
  50.     end if
  51.   end if
  52.   if dontScroll is false then
  53.     if choice is "left" then
  54.       visual scroll right
  55.     else
  56.       visual scroll left
  57.     end if
  58.     pass arrowKey
  59.   end if
  60. end arrowKey
  61.  
  62. on updatePageNumbers
  63.   set cursor to watch
  64.   put the number of card "contents" into presentCard
  65.   repeat for the number of cards in this background
  66.     put presentCard into field "page no" of card presentCard
  67.     updateFootnotes presentCard
  68.     add 1 to presentCard
  69.   end repeat
  70. end updatePageNumbers
  71.  
  72. on updateFootnotes presentCard
  73.   global deletedCard
  74.   get line 1 of field "topic" of card presentCard
  75.   put it into field "footnote1" of card presentCard
  76.   if it is not "" then
  77.     get line 1 of field "card id" of card presentCard
  78.     if it is not "" then
  79.       if it is word 3 of deletedCard then
  80.         put "" into line 1 of field "card id" of card presentCard
  81.       else
  82.         get the number of card id it
  83.         put " - p" & it after field "footnote1" of card presentCard
  84.       end if
  85.     end if
  86.   end if
  87.   get line 2 of field "topic" of card presentCard
  88.   put it into field "footnote2" of card presentCard
  89.   if it is not "" then
  90.     get line 2 of field "card id" of card presentCard
  91.     if it is not "" then
  92.       if it is word 3 of deletedCard then
  93.         put "" into line 2 of field "card id" of card presentCard
  94.       else
  95.         get the number of card id it
  96.         put " - p" & it after field "footnote2" of card presentCard
  97.       end if
  98.     end if
  99.   end if
  100. end updateFootnotes
  101.  
  102. on updateBookmarks presentCard
  103.   global deletedCard
  104.   global bookmark1
  105.   global bookmark2
  106.   if bookmark1 is not 0 then
  107.     if bookmark1 is deletedCard then
  108.       put 0 into bookmark1
  109.       hide background button "bookmark1"
  110.       hide field "bookmark1"
  111.       put "" into field "bookmark1" of card presentCard
  112.     else
  113.       get number of bookmark1
  114.       put "p" & it into field "bookmark1" of card presentCard
  115.     end if
  116.   else
  117.     put "" into field "bookmark1" of card presentCard
  118.   end if
  119.   if bookmark2 is not 0 then
  120.     if bookmark2 is deletedCard then
  121.       put 0 into bookmark2
  122.       hide background button "bookmark2"
  123.       hide field "bookmark2"
  124.       put "" into field "bookmark2" of card presentCard
  125.     else
  126.       get number of bookmark2
  127.       put "p" & it into field "bookmark2" of card presentCard
  128.     end if
  129.   else
  130.     put "" into field "bookmark2" of card presentCard
  131.   end if
  132. end updateBookmarks
  133.  
  134. on idle
  135.   global cardJustPasted
  136.   global cardJustDeleted
  137.   global deletedCard
  138.   global stackJustPrinted
  139.   if stackJustPrinted then
  140.     put false into stackJustPrinted
  141.     send showFootnotes
  142.     pop card
  143.   else
  144.     if cardJustDeleted then
  145.       put false into cardJustDeleted
  146.       updateBookmarks (the number of this card)
  147.       send showBookmarks
  148.       send showFootnotes
  149.     else
  150.       if cardJustPasted then
  151.         put false into cardJustPasted
  152.         set lockScreen to true
  153.         push card
  154.         go card "contents"
  155.         get the id of this background
  156.         pop card
  157.         set lockScreen to false
  158.         if it is not the id of this background then
  159.           -- i.e. this is not a true "page" card
  160.           answer "Background has changed; delete this card!" with "OK"
  161.         else
  162.           if the id of this card is deletedCard then
  163.             put "" into deletedCard
  164.           end if
  165.         end if
  166.       end if
  167.     end if
  168.   end if
  169.   pass idle
  170. end idle
  171.  
  172. on openBackground
  173.   global xrefdepth
  174.   if xrefdepth is 0 then
  175.     hide background button "return"
  176.   end if
  177. end openBackground
  178.  
  179.  
  180.  
  181. -- part 1 (button)
  182. -- low flags: 00
  183. -- high flags: 0000
  184. -- rect: left=424 top=314 right=337 bottom=453
  185. -- title width / last selected line: 0
  186. -- icon id / first selected line: 1014 / 1014
  187. -- text alignment: 1
  188. -- font id: 0
  189. -- text size: 12
  190. -- style flags: 0
  191. -- line height: 16
  192. -- part name: 
  193. ----- HyperTalk script -----
  194. on mouseDown
  195.   global alreadyPaged
  196.   put false into alreadyPaged
  197.   pass mouseDown
  198. end mouseDown
  199.  
  200. on mouseStillDown
  201.   global alreadyPaged
  202.   wait 10
  203.   visual effect scroll right
  204.   put true into alreadyPaged
  205.   go to previous card
  206. end mouseStillDown
  207.  
  208. on mouseUp
  209.   global alreadyPaged
  210.   if alreadyPaged is false then
  211.     visual effect scroll right
  212.     go to previous card
  213.   end if
  214. end mouseUp
  215.  
  216.  
  217.  
  218. -- part 2 (button)
  219. -- low flags: 00
  220. -- high flags: 0000
  221. -- rect: left=480 top=314 right=337 bottom=508
  222. -- title width / last selected line: 0
  223. -- icon id / first selected line: 1013 / 1013
  224. -- text alignment: 1
  225. -- font id: 0
  226. -- text size: 12
  227. -- style flags: 0
  228. -- line height: 16
  229. -- part name: 
  230. ----- HyperTalk script -----
  231. on mouseDown
  232.   global alreadyPaged
  233.   put false into alreadyPaged
  234.   pass mouseDown
  235. end mouseDown
  236.  
  237. on mouseStillDown
  238.   global alreadyPaged
  239.   wait 10
  240.   visual effect scroll left
  241.   put true into alreadyPaged
  242.   go to next card
  243. end mouseStillDown
  244.  
  245. on mouseUp
  246.   global alreadyPaged
  247.   if alreadyPaged is false then
  248.     visual effect scroll left
  249.     go to next card
  250.   end if
  251. end mouseUp
  252.  
  253.  
  254.  
  255. -- part 3 (button)
  256. -- low flags: 80
  257. -- high flags: 0000
  258. -- rect: left=400 top=316 right=339 bottom=427
  259. -- title width / last selected line: 0
  260. -- icon id / first selected line: 1012 / 1012
  261. -- text alignment: 1
  262. -- font id: 0
  263. -- text size: 12
  264. -- style flags: 0
  265. -- line height: 16
  266. -- part name: return
  267. ----- HyperTalk script -----
  268. on mouseUp
  269.   global xrefdepth
  270.   subtract 1 from xrefdepth
  271.   if xrefdepth = 0 then
  272.     hide background button "return"
  273.   end if
  274.   visual effect iris close
  275.   pop card
  276. end mouseUp
  277.  
  278.  
  279.  
  280. -- part 4 (field)
  281. -- low flags: 01
  282. -- high flags: 0000
  283. -- rect: left=14 top=60 right=300 bottom=494
  284. -- title width / last selected line: 0
  285. -- icon id / first selected line: 0 / 0
  286. -- text alignment: 0
  287. -- font id: 2
  288. -- text size: 10
  289. -- style flags: 0
  290. -- line height: 13
  291. -- part name: text
  292.  
  293.  
  294. -- part 6 (field)
  295. -- low flags: 01
  296. -- high flags: 0000
  297. -- rect: left=14 top=29 right=57 bottom=348
  298. -- title width / last selected line: 0
  299. -- icon id / first selected line: 0 / 0
  300. -- text alignment: 0
  301. -- font id: 2
  302. -- text size: 18
  303. -- style flags: 0
  304. -- line height: 24
  305. -- part name: heading
  306. ----- HyperTalk script -----
  307. on closeField
  308.   if cardInContents() then
  309.     put the userLevel into currentLevel
  310.     set the userLevel to 5
  311.     set lockScreen to true
  312.     doMenu "New Field"
  313.     put the number of card fields into numFields
  314.     choose browse tool
  315.     set the style of card field numFields to shadow
  316.     put "Updating Table of Contents." & numToChar(13) & "Please wait..." into card field numFields
  317.     set lockScreen to false
  318.     send updateContents to card "contents"
  319.     set lockScreen to true
  320.     choose field tool
  321.     click at the loc of card field numFields
  322.     doMenu "Clear Field"
  323.     choose browse tool
  324.     set lockScreen to false
  325.     set the userLevel to currentLevel
  326.   end if
  327.   pass closeField
  328. end closeField
  329.  
  330. function cardInContents
  331. set the cursor to watch
  332. get word 3 of the id of this card
  333. put false into inContents
  334. repeat with x = 1 to the number of lines in card field "content list" of card "contents"
  335.   if (line x of card field "content list" of card "contents") is it then
  336.     put true into inContents
  337.   end if
  338. end repeat
  339. return inContents
  340. end cardInContents
  341.  
  342.  
  343.  
  344. -- part 7 (field)
  345. -- low flags: 01
  346. -- high flags: 0000
  347. -- rect: left=461 top=33 right=51 bottom=494
  348. -- title width / last selected line: 0
  349. -- icon id / first selected line: 0 / 0
  350. -- text alignment: 65535
  351. -- font id: 2
  352. -- text size: 10
  353. -- style flags: 0
  354. -- line height: 13
  355. -- part name: page no
  356.  
  357.  
  358. -- part 8 (button)
  359. -- low flags: 00
  360. -- high flags: 0000
  361. -- rect: left=8 top=311 right=334 bottom=39
  362. -- title width / last selected line: 0
  363. -- icon id / first selected line: 13081 / 13081
  364. -- text alignment: 1
  365. -- font id: 0
  366. -- text size: 12
  367. -- style flags: 0
  368. -- line height: 16
  369. -- part name: Contents
  370. ----- HyperTalk script -----
  371. on mouseUp
  372.   visual iris close
  373.   go card "contents"
  374. end mouseUp
  375.  
  376.  
  377.  
  378. -- part 9 (button)
  379. -- low flags: 00
  380. -- high flags: 0000
  381. -- rect: left=453 top=313 right=337 bottom=476
  382. -- title width / last selected line: 0
  383. -- icon id / first selected line: 0 / 0
  384. -- text alignment: 1
  385. -- font id: 0
  386. -- text size: 12
  387. -- style flags: 0
  388. -- line height: 16
  389. -- part name: book
  390. ----- HyperTalk script -----
  391. on mouseUp
  392.   -- Actually, to be really consistent we should update the bookmarks
  393.   -- of ALL pages here, so that when you Print Report they are all
  394.   -- correct.  However, this would slow things down for the reader.
  395.   global bookmark1
  396.   global bookmark2
  397.   get the id of this card
  398.   if bookmark1 = 0 then
  399.     put it into bookmark1
  400.     updateBookmarks (the number of this card)
  401.     show background button "bookmark1"
  402.     show field "bookmark1"
  403.     send showBookmarks
  404.   else
  405.     if bookmark2 = 0 then
  406.       put it into bookmark2
  407.       updateBookmarks (the number of this card)
  408.       show background button "bookmark2"
  409.       show field "bookmark2"
  410.       send showBookmarks
  411.     else
  412.       answer "Out of bookmarks!" with "OK"
  413.     end if
  414.   end if
  415. end mouseUp
  416.  
  417.  
  418.  
  419.  
  420. -- part 11 (button)
  421. -- low flags: 80
  422. -- high flags: 0000
  423. -- rect: left=451 top=313 right=337 bottom=476
  424. -- title width / last selected line: 0
  425. -- icon id / first selected line: 18951 / 18951
  426. -- text alignment: 1
  427. -- font id: 0
  428. -- text size: 12
  429. -- style flags: 0
  430. -- line height: 16
  431. -- part name: mark
  432. ----- HyperTalk script -----
  433. on mouseUp
  434.   global bookmark1
  435.   global bookmark2
  436.   get the id of this card
  437.   if it is bookmark1 then
  438.     put 0 into bookmark1
  439.     hide background button "bookmark1"
  440.     hide field "bookmark1"
  441.   end if
  442.   if it is bookmark2 then
  443.     put 0 into bookmark2
  444.     hide background button "bookmark2"
  445.     hide field "bookmark2"
  446.   end if
  447.   updateBookmarks (the number of this card)
  448.   send showBookmarks
  449. end mouseUp
  450.  
  451.  
  452.  
  453. -- part 17 (field)
  454. -- low flags: 81
  455. -- high flags: 0002
  456. -- rect: left=366 top=326 right=340 bottom=399
  457. -- title width / last selected line: 0
  458. -- icon id / first selected line: 0 / 0
  459. -- text alignment: 1
  460. -- font id: 4
  461. -- text size: 9
  462. -- style flags: 0
  463. -- line height: 12
  464. -- part name: bookmark1
  465.  
  466.  
  467. -- part 18 (field)
  468. -- low flags: 81
  469. -- high flags: 0002
  470. -- rect: left=331 top=326 right=340 bottom=364
  471. -- title width / last selected line: 0
  472. -- icon id / first selected line: 0 / 0
  473. -- text alignment: 1
  474. -- font id: 4
  475. -- text size: 9
  476. -- style flags: 0
  477. -- line height: 12
  478. -- part name: bookmark2
  479.  
  480.  
  481. -- part 13 (button)
  482. -- low flags: 80
  483. -- high flags: 0000
  484. -- rect: left=336 top=300 right=339 bottom=362
  485. -- title width / last selected line: 0
  486. -- icon id / first selected line: 6179 / 6179
  487. -- text alignment: 1
  488. -- font id: 0
  489. -- text size: 12
  490. -- style flags: 0
  491. -- line height: 16
  492. -- part name: bookmark2
  493. ----- HyperTalk script -----
  494. on mouseUp
  495.   global bookmark1
  496.   global bookmark2
  497.   if the id of this card is not bookmark2 then
  498.     if (the name of this card is not the name of card "contents") and (the id of this card is not bookmark1) then
  499.       global xrefdepth
  500.       add 1 to xrefdepth
  501.       push card
  502.       show background button "return"
  503.     end if
  504.     visual effect iris open
  505.     go bookmark2
  506.   end if
  507. end mouseUp
  508.  
  509.  
  510.  
  511. -- part 12 (button)
  512. -- low flags: 80
  513. -- high flags: 0000
  514. -- rect: left=366 top=300 right=339 bottom=392
  515. -- title width / last selected line: 0
  516. -- icon id / first selected line: 6179 / 6179
  517. -- text alignment: 1
  518. -- font id: 0
  519. -- text size: 12
  520. -- style flags: 0
  521. -- line height: 16
  522. -- part name: bookmark1
  523. ----- HyperTalk script -----
  524. on mouseUp
  525.   global bookmark1
  526.   global bookmark2
  527.   if the id of this card is not bookmark1 then
  528.     if (the name of this card is not the name of card "contents") and (the id of this card is not bookmark2) then
  529.       global xrefdepth
  530.       add 1 to xrefdepth
  531.       push card
  532.       show background button "return"
  533.     end if
  534.     visual effect iris open
  535.     go bookmark1
  536.   end if
  537. end mouseUp
  538.  
  539.  
  540.  
  541. -- part 20 (field)
  542. -- low flags: 81
  543. -- high flags: 0002
  544. -- rect: left=54 top=309 right=324 bottom=321
  545. -- title width / last selected line: 0
  546. -- icon id / first selected line: 0 / 0
  547. -- text alignment: 0
  548. -- font id: 2
  549. -- text size: 10
  550. -- style flags: 0
  551. -- line height: 13
  552. -- part name: footnote1
  553. ----- HyperTalk script -----
  554. on mouseUp
  555.   get line 1 of field "card id"
  556.   if it is not "" then
  557.     global xrefdepth
  558.     add 1 to xrefdepth
  559.     push card
  560.     show background button "return"
  561.     visual iris open
  562.     get last word of me
  563.     put "" into first char of it
  564.     go card it
  565.   end if
  566. end mouseUp
  567.  
  568.  
  569.  
  570. -- part 23 (field)
  571. -- low flags: 81
  572. -- high flags: 0002
  573. -- rect: left=54 top=325 right=340 bottom=321
  574. -- title width / last selected line: 0
  575. -- icon id / first selected line: 0 / 0
  576. -- text alignment: 0
  577. -- font id: 2
  578. -- text size: 10
  579. -- style flags: 0
  580. -- line height: 13
  581. -- part name: footnote2
  582. ----- HyperTalk script -----
  583. on mouseUp
  584.   get line 2 of field "card id"
  585.   if it is not "" then
  586.     global xrefdepth
  587.     add 1 to xrefdepth
  588.     push card
  589.     show background button "return"
  590.     visual iris open
  591.     get last word of me
  592.     put "" into first char of it
  593.     go card it
  594.   end if
  595. end mouseUp
  596.  
  597.  
  598.  
  599. -- part 30 (button)
  600. -- low flags: 80
  601. -- high flags: 0000
  602. -- rect: left=1 top=21 right=340 bottom=510
  603. -- title width / last selected line: 0
  604. -- icon id / first selected line: 0 / 0
  605. -- text alignment: 1
  606. -- font id: 0
  607. -- text size: 12
  608. -- style flags: 0
  609. -- line height: 16
  610. -- part name: beep
  611. ----- HyperTalk script -----
  612. on mouseUp
  613.   beep
  614. end mouseUp
  615.  
  616.  
  617.  
  618. -- part 26 (button)
  619. -- low flags: 80
  620. -- high flags: A003
  621. -- rect: left=364 top=26 right=43 bottom=467
  622. -- title width / last selected line: 0
  623. -- icon id / first selected line: 0 / 0
  624. -- text alignment: 1
  625. -- font id: 0
  626. -- text size: 12
  627. -- style flags: 0
  628. -- line height: 16
  629. -- part name: Done Changes
  630. ----- HyperTalk script -----
  631. on mouseUp
  632.   hide background button "beep"
  633.   hide background button "Topic"
  634.   hide background button "Card ID (optional)"
  635.   hide field "topic"
  636.   hide field "card id"
  637.   hide background button "Done Changes"
  638.   show background button "Add Footnote"
  639.   updateFootnotes (the number of this card)
  640.   send showFootnotes
  641. end mouseUp
  642.  
  643.  
  644.  
  645. -- part 25 (button)
  646. -- low flags: 80
  647. -- high flags: A003
  648. -- rect: left=364 top=26 right=43 bottom=466
  649. -- title width / last selected line: 0
  650. -- icon id / first selected line: 0 / 0
  651. -- text alignment: 1
  652. -- font id: 0
  653. -- text size: 12
  654. -- style flags: 0
  655. -- line height: 16
  656. -- part name: Add Footnote
  657. ----- HyperTalk script -----
  658. on mouseUp
  659.   show background button "beep"
  660.   show background button "Topic"
  661.   show background button "Card ID (optional)"
  662.   show field "topic"
  663.   show field "card id"
  664.   hide background button "Add Footnote"
  665.   show background button "Done Changes"
  666. end mouseUp
  667.  
  668.  
  669.  
  670. -- part 28 (button)
  671. -- low flags: 80
  672. -- high flags: 8002
  673. -- rect: left=51 top=111 right=133 bottom=318
  674. -- title width / last selected line: 0
  675. -- icon id / first selected line: 0 / 0
  676. -- text alignment: 1
  677. -- font id: 0
  678. -- text size: 12
  679. -- style flags: 0
  680. -- line height: 16
  681. -- part name: Topic
  682.  
  683.  
  684. -- part 31 (button)
  685. -- low flags: 80
  686. -- high flags: 8002
  687. -- rect: left=317 top=111 right=133 bottom=448
  688. -- title width / last selected line: 0
  689. -- icon id / first selected line: 0 / 0
  690. -- text alignment: 1
  691. -- font id: 0
  692. -- text size: 12
  693. -- style flags: 0
  694. -- line height: 16
  695. -- part name: Card ID (optional)
  696.  
  697.  
  698. -- part 27 (field)
  699. -- low flags: 80
  700. -- high flags: 0002
  701. -- rect: left=51 top=132 right=162 bottom=318
  702. -- title width / last selected line: 0
  703. -- icon id / first selected line: 0 / 0
  704. -- text alignment: 0
  705. -- font id: 4
  706. -- text size: 9
  707. -- style flags: 0
  708. -- line height: 12
  709. -- part name: topic
  710.  
  711.  
  712. -- part 29 (field)
  713. -- low flags: 80
  714. -- high flags: 0002
  715. -- rect: left=317 top=132 right=162 bottom=448
  716. -- title width / last selected line: 0
  717. -- icon id / first selected line: 0 / 0
  718. -- text alignment: 0
  719. -- font id: 4
  720. -- text size: 9
  721. -- style flags: 0
  722. -- line height: 12
  723. -- part name: card id
  724.  
  725.  
  726. -- part 33 (button)
  727. -- low flags: 80
  728. -- high flags: A003
  729. -- rect: left=356 top=44 right=61 bottom=475
  730. -- title width / last selected line: 0
  731. -- icon id / first selected line: 0 / 0
  732. -- text alignment: 1
  733. -- font id: 0
  734. -- text size: 12
  735. -- style flags: 0
  736. -- line height: 16
  737. -- part name: Update Page Nos
  738. ----- HyperTalk script -----
  739. on mouseUp
  740.   global deletedCard
  741.   hide background button "Update Page Nos"
  742.   put the userLevel into currentLevel
  743.   set the userLevel to 5
  744.   set lockScreen to true
  745.   doMenu "New Field"
  746.   put the number of card fields into numFields
  747.   choose browse tool
  748.   set the style of card field numFields to shadow
  749.   put "Updating page numbers." & numToChar(13) & "Please wait..." into card field numFields
  750.   set lockScreen to false
  751.   send updatePageNumbers
  752.   send showFootnotes
  753.   updateBookmarks (the number of this card)
  754.   -- Actually, to be really consistent we should update ALL the
  755.   -- bookmarks here, so that when you Print Report they are all
  756.   -- correct.  However, bookmarks are not that important.
  757.   send showBookmarks
  758.   send updateContents to card "contents"
  759.   set lockScreen to true
  760.   choose field tool
  761.   click at the loc of card field numFields
  762.   doMenu "Clear Field"
  763.   choose browse tool
  764.   set lockScreen to false
  765.   set the userLevel to currentLevel
  766.   put "" into deletedCard
  767.   beep
  768. end mouseUp
  769.  
  770.